class A():
    def __enter__(self):
        a = 1
        print('i am come in')
        return a

    def __exit__(self, exc_type, exc_value, tb):
        if tb:
            print('this has a err')
        else:
            print('ok')
            print('all is ok')
            print('i am exit')
        # return True


try:
    with A() as a:
        print(type(a))
        print(a)
        1/0
except:
    pass
